From: Daniel Drake Date: Sun, 12 Jun 2011 16:48:17 +0000 (+0100) Subject: gtkdnd: Don't bind/unbind keycodes that couldn't be determined X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~21046 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=794a3706cd29f8457731b09ac39870ee1d11bf94;p=gtk%2B3.0.git gtkdnd: Don't bind/unbind keycodes that couldn't be determined At http://dev.laptop.org/ticket/10643 we are seeing that drag-and-drop within the Sugar shell causes all of Sugar's custom keybindings to be removed. This is because gtkdnd tries to unbind XK_KP_Space, which (on my systems) is resolved to NoSymbol by XKeycodeToKeysym(). NoSymbol has value 0, the same as AnyKey, and XUngrabKey(AnyKey) is equivalent to unbinding all possible keycodes. Fix this by catching NoSymbol before binding/unbinding. https://bugzilla.gnome.org/show_bug.cgi?id=652402 --- diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 4805a6fe18..617a02e312 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -475,6 +475,8 @@ grab_dnd_keys (GtkWidget *widget, for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i) { keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym); + if (keycode == NoSymbol) + continue; XGrabKey (GDK_WINDOW_XDISPLAY (window), keycode, grab_keys[i].modifiers, GDK_WINDOW_XID (root), @@ -508,6 +510,8 @@ ungrab_dnd_keys (GtkWidget *widget, for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i) { keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym); + if (keycode == NoSymbol) + continue; XUngrabKey (GDK_WINDOW_XDISPLAY (window), keycode, grab_keys[i].modifiers, GDK_WINDOW_XID (root));